package com.example.yuejian21.nongfusanquan.yuejian21.model;

import com.example.yuejian21.nongfusanquan.yuejian21.javabean.MeBean;
import com.example.yuejian21.nongfusanquan.yuejian21.javabean.Myactivitybean;
import com.example.yuejian21.nongfusanquan.yuejian21.javabean.Orderbean;
import com.example.yuejian21.nongfusanquan.yuejian21.javabean.Postbean;
import com.example.yuejian21.nongfusanquan.yuejian21.javabean.Userbean;
import com.example.yuejian21.nongfusanquan.yuejian21.service.PostService;
import com.example.yuejian21.nongfusanquan.yuejian21.service.UserService;

import java.util.List;

import retrofit2.Call;
import retrofit2.Retrofit;
import retrofit2.converter.gson.GsonConverterFactory;

/**
 * Created by Nongfusanquan on 2017-10-10.
 */

public class Usermodel {
    private Retrofit retrofit;
    public Usermodel(){
        retrofit = new Retrofit.Builder()
                .baseUrl("http://10.0.2.2/yuejian14/index.php/API/")
                .addConverterFactory(GsonConverterFactory.create())
                .build();
    }
    public retrofit2.Call login(String str_user, String str_password){
        UserService loginService = retrofit.create(UserService.class);
        return  loginService.getuserLogin(str_user,str_password);
    }

    public Call<MeBean> updateuser(int u_id ,String u_name,String u_pass,String u_phone) {
        UserService userService = retrofit.create(UserService.class);
        return userService.updateuser(u_id, u_name,u_pass,u_phone);
    }
    public Call<MeBean> edituser(int u_id) {
        UserService userService = retrofit.create(UserService.class);
        return userService.edituser(u_id);
    }
    public Call<Userbean> getUserInfo(int u_id) {
        UserService userService = retrofit.create(UserService.class);
        return userService.getUserInfo(u_id);
    }
    public Call<List<Orderbean>> getMyTrainOrderlist(int u_id) {
        UserService userService = retrofit.create(UserService.class);
        return userService.getMyTrainOrderlist(u_id);
    }
    public Call<List<Myactivitybean>> getMyActOrderlist(int u_id) {
        UserService userService = retrofit.create(UserService.class);
        return userService.getMyActOrderlist(u_id);
    }
}
